package com.accp.demo.controller.purchase;
 
import static org.mockito.Matchers.booleanThat;

import java.text.SimpleDateFormat;
import java.util.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.accp.demo.pojo.PageBean;
import com.accp.demo.pojo.purchase.PurchaseInquiry;
import com.accp.demo.pojo.purchase.PurchaseInquiryDetail;
import com.accp.demo.service.purchase.PurchaseInquiryService;



/**
 * 采购询价 控制器
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/cgxjd/")
public class PurchseInquiryController {
	
	@Autowired
	private PurchaseInquiryService iservice;
	
	//根据编号查询主从表
	@RequestMapping("queryInquiry")
	@ResponseBody
	public PurchaseInquiry queryInquiry(String id){
		return iservice.findQueryInquiryBiz(id);
	}
	//新增主从表
	@RequestMapping("saveOrUpdate")
	@ResponseBody
	public Object add(@RequestBody Map<String, Object> map){
			System.out.println("===============");
		iservice.savePurchaseInquiryBiz(map);
		return "处理成功";
	}
	
	
	
		
	//查询主从表
	@RequestMapping("pageInquiry")
	@ResponseBody
	public PageBean pageInquiry(Integer page,Integer limit){
		return iservice.findQueryInquiryPageBiz(page,limit);
	}
	
	//逻辑删除
	@ResponseBody
	@RequestMapping("updLogicalState")
	public Object updLogicalState(@RequestBody Map<String, Object> map){
		boolean b=iservice.updateInquiryDel(map);
		System.out.println(b);
		return "修改状态成功";
	}
	
	//逻辑删除
//	@RequestMapping("updateState")
//	@ResponseBody
//	public String updateState(String id,Integer state){
//		iservice.updateInquiryDel(id, state);
//		return "修改状态成功";
//	}
	
	@ResponseBody
	@RequestMapping("getNewNo")
	public Object getNewNo(@RequestParam Map<String, Object> map){
		return iservice.getNewNo(map);
	}
	

	@ResponseBody
	@RequestMapping("updExamineAfter")
	public Object updExamineAfter(@RequestBody Map<String, Object> map){
		return this.iservice.updateInquirySH(map);
	}
}
